/*============================================================================
 PROJECT: DealHits
 FILE:    ShareActionSheet.m
 AUTHOR:  Khoai Nguyen
 DATE:    7/26/13
 =============================================================================*/

/*============================================================================
 IMPORT
 =============================================================================*/
#import "ShareActionSheet.h"

/*============================================================================
 PRIVATE MACRO
 =============================================================================*/
/*============================================================================
 PRIVATE INTERFACE
 =============================================================================*/

@implementation ShareActionSheet

+ (id)sharedShareActionSheet {
	static dispatch_once_t predicate;
	static ShareActionSheet *instance = nil;
	dispatch_once(&predicate, ^{instance = [[self alloc] init];});
	return instance;
}
#if (!__has_feature(objc_arc))

- (id)retain {
    
    return self;
}

- (unsigned)retainCount {
    return UINT_MAX;  //denotes an object that cannot be released
}

- (oneway void)release {
    //do nothing
}

- (id)autorelease {
    
    return self;
}
#endif

- (void)showOnView:(UIView *)view completedBlock:(void(^)(ShareActionSheet *view, NSInteger index))completedBlock {
    self.touchedActionButtonBlock = completedBlock;
    
    UIActionSheet   *actionSheet = [[UIActionSheet alloc] initWithTitle:@"How would you like to share these items?"
                                                               delegate:self
                                                      cancelButtonTitle:@"Cancel"
                                                 destructiveButtonTitle:nil
                                                      otherButtonTitles:@"Email", @"Text Message", @"Facebook Message", @"Post to Facebook", @"Tweet", nil];
    
    /* show action sheet in block style */
    [actionSheet showInView:view withCompletionHanlder:^(UIActionSheet *actionSheet, NSInteger selectedIndex) {
        switch (selectedIndex) {
            case 0: { /* Email */
                
            } break;

            case 1: { /* Text Message */
                
            } break;
                
            case 2: { /* Facebook Message */
                
            } break;
                
            case 3: { /* Post to Facebook */
                
            } break;
                
            case 4: { /* Tweet */
                
            } break;
               
            case 5: { /* Copy Link to Clipboard */
                
            } break;
                
            default:
                break;
        }
    }];
}

@end
